package server;

public class Message {
    private Client clientFrom;
    private String nameFrom;
    private String nameTo;
    private String room;
    private String dateTime;
    private String text;

    public Message(Client clientFrom, String nameTo, String room, String dateTime, String text) {
        this.clientFrom = clientFrom;
        this.nameFrom = clientFrom.getName();
        this.nameTo = nameTo;
        this.room = room;
        this.dateTime = dateTime;
        this.text = text;
    }

    public Message(String nameFrom, String nameTo, String room, String dateTime, String text) {
        this.nameFrom = nameFrom;
        this.nameTo = nameTo;
        this.room = room;
        this.dateTime = dateTime;
        this.text = text;
    }


    public String getNameFrom() {
        return nameFrom;
    }

    public void setNameFrom(String nameFrom) {
        this.nameFrom = nameFrom;
    }

    @Override
    public String toString() {
        String text = this.getDateTime() + " " + this.getNameFrom() + ": " + this.getText();
        return text;

    }

    public Client getClientFrom() {
        return clientFrom;
    }

    public String getNameTo() {
        return nameTo;
    }

    public String getRoom() {
        return room;
    }

    public String getDateTime() {
        return dateTime;
    }

    public String getText() {
        return text;
    }
}
